define(".", [ "static_v4/js/minJS/commonPlug/commonPlug.min", "static_v4/js/plug/swiper/swiper.min", "static_v4/js/plug/jroll/jroll.min", "static_v4/js/mod/historyCookie", "static_v4/js/mod/public", "static_v4/js/plug/base64", "static_v4/js/mod/webcall_message", "static_v4/js/mod/categorysList_new_sea", "static_v4/js/mod/visualAreaInfo", "static_v4/js/mod/baiduCount" ], function(require, exports, module) {
    require("static_v4/js/minJS/commonPlug/commonPlug.min");
    require("static_v4/js/plug/swiper/swiper.min");
    require("static_v4/js/plug/jroll/jroll.min");
    require("static_v4/js/mod/historyCookie");
    require("static_v4/js/mod/webcall_message");
    var OIndexSea = require("static_v4/js/mod/categorysList_new_sea");
    module.exports = {
        init: function(data, name) {
            OIndexSea.init(data, name);
        }
    };
    require("static_v4/js/mod/baiduCount");
});
define("static_v4/js/mod/categorysList_new_sea", [ "./public", "./visualAreaInfo" ], function(require, exports, module) {
    var myPub = require("./public");
    // 曝光可视区域元素
    var visualArea = require("./visualAreaInfo");
    var oWindow = $(window);
    var oWrap = $(".js_wrap");
    var oCategorysBox = $(".js_categorysBox");
    // 分类容器
    var oCategorysNavList = $(".js_categorysNavList");
    // 导航列表父级
    var oCategoryAllList = $(".js_categorysAllList");
    var oSildeNavJRoll = new myPub.ScrollBar();
    // 导航滚动条
    var oHeader = $(".js_headerBox");
    // 页面头部
    var oFooter = $(".js_footer");
    // 页面底部
    var oContain = $(".js_contain");
    var oTurnLeftGuide = $(".js_turnLeftGuide");
    // 页面下部向左滑的引导文字
    var rightOff = $(".js_rightList").hasClass("js_rightActive");
    // 判断是子分类页还是分类列表页的盒子
    var resizeTimer = null;
    var loadChildCategoryUrl = "/category/loadCategory";
    var loadCategoryGoodsUrl = "/category/loadOne";
    var loadSliderImgUrl = "/category/loadCategoryMaterial";
    // 分类轮播图数据
    var perLimit = 20;
    var oCategorysNavControl = $(".js_categorysNavControl");
    // 收起和展开
    var sTapOff = true;
    // 收起展开 开关
    var oTapOff_time = null;
    // 收起展开 定时器
    var oCategorysNav_time = null;
    // 导航收起展开 定时器
    var lazLoading = new myPub.lazLoadingImg();
    module.exports = {
        init: function(data, names) {
            cateList.cateInit(true);
            cateList.SetNavList(names);
            // 历史数据初始化
            cateData.HistoryInit();
            // 改变尺寸时更新
            oWindow.resize(function() {
                if (resizeTimer) {
                    clearTimeout(resizeTimer);
                }
                resizeTimer = setTimeout(function() {
                    cateList.cateInit(true);
                    cateList.appendSlide();
                    if (!rightOff) {
                        var NavIndex = oCategorysNavList.find("li.active").index();
                        var getGoodsWidth = oCategorysBox.find(".js_categorysDetail").eq(NavIndex).find("li figure").eq(0).parents("a").width();
                        myPub.SetImgHeight(oCategorysBox, getGoodsWidth);
                    }
                }, 400);
            });
            // 页面跳转记录数据
            oWindow.unload(function() {
                cateData.SetSession();
            });
        }
    };
    // 点击导航展示对应容器
    oCategoryAllList.hammer().on("tap", function(e) {
        var tar = e.gesture.target;
        var $target = $(tar);
        var slideNum, slideNetNum;
        if (tar.tagName.toLowerCase() == "li") {
            if ($target.hasClass("categoryLeftNav")) {
                var index = $target.index();
                //记住最新点击的左侧导航索引
                cateData.catePageNum = index;
                //当点击导航时初始化slider滑动索引
                cateData.cateSlideNum = 0;
                oCategorysNavList.find("li").removeClass("active");
                $target.addClass("active");
                oCategorysBox.find(".js_categorysDetail").hide().eq(index).show();
                if (cateList.loadOff[index]) {
                    cateList.updateShowCon(cateData.catePageNum, cateData.cateSlideNum, cateData.arrNum);
                }
                // 点击侧边导航时让页面下部的“向左滑会有更多精彩哦~”在空数据或者最后一页不显示
                if (!rightOff) {
                    slideNum = sessionStorage.getItem("cateSlideNum");
                } else {
                    slideNum = sessionStorage.getItem("cateDetSlideNum");
                }
                if (slideNum && cateData.arrNum[index] == slideNum * 1 + 1) {
                    oTurnLeftGuide.hide();
                } else if (cateData.arrNum[index] <= 1) {
                    oTurnLeftGuide.hide();
                } else if (cateData.arrNum[index] == undefined) {
                    oTurnLeftGuide.hide();
                } else {
                    oTurnLeftGuide.show();
                }
            }
        }
        var rightGoodsNav = $target.parents(".jsCategoryRightNav");
        if (rightGoodsNav.length > 0) {
            var curIndex = rightGoodsNav.find(".jsHrefCategory").attr("data-curIdx");
            if (curIndex == null) {
                curIndex = 0;
            }
            sessionStorage.setItem("cateDetPageNum", curIndex);
            sessionStorage.setItem("cateDetSlideNum", 0);
        }
    });
    // 显示和隐藏导航
    oCategorysNavControl.hammer().on("tap", function(e) {
        var _this = $(this);
        if (sTapOff) {
            sTapOff = false;
            if (_this.hasClass("on")) {
                // 展开
                _this.removeClass("on");
                cateList.NavAnimate(true);
                cateList.NavHideTimer();
            } else {
                // 收起
                _this.addClass("on");
                cateList.NavAnimate(false);
            }
            clearTimeout(oTapOff_time);
            oTapOff_time = setTimeout(function() {
                sTapOff = true;
            }, 1200);
        }
        myPub.HamstopPropaga();
    });
    var sliderData = {
        swiperImgData: [],
        // 有轮播图数据的分类
        swiperImg: [],
        // 轮播图的集合
        swiperImgUrl: [],
        // 轮播图的跳转链接
        setSwiperTime: "",
        // 轮播图动起来的定时器
        getSliderData: function(index, groupId, fn) {
            var _this = this;
            _this.swiperImg = [];
            _this.swiperImgUrl = [];
            G_JSON_GET(loadSliderImgUrl, {
                groupId: groupId
            }, function(data) {
                if (data && data != null && data != undefined && data.length > 0) {
                    for (var i = 0; i < data.length; i++) {
                        var imageUrl = data[i].imageUrl;
                        if (imageUrl != null && imageUrl != "" && imageUrl != undefined) {
                            _this.swiperImg.push(imageUrl);
                            _this.swiperImgUrl.push(data[i].url);
                        }
                    }
                    if (_this.swiperImg.length > 0) {
                        _this.swiperImgData[index] = true;
                        if (groupId == -1) {
                            // 如果是推荐页面
                            var oWrapperPage = $(".js_wrapperPage").eq(index);
                            oWrapperPage.find(".js_commend").append(_this.commHtml(_this.swiperImg, _this.swiperImgUrl));
                            oTurnLeftGuide.hide();
                            // 有时候懒加载出不来  就让它滚1像素
                            setTimeout(function() {
                                lazLoading.DestroyLazLoadingImg();
                                lazLoading.AddLazLoadingImg(oWrapperPage.find(".js_commend")[0]);
                                oWrapperPage.find(".js_commend").scrollTop(1);
                            }, 300);
                        }
                    }
                }
                if (fn) fn();
            }, function() {}, function() {});
        },
        // 轮播图拼接
        sliderHtml: function(imgageData, urlData) {
            var _this = this;
            var shtml = "";
            for (var i = 0; i < imgageData.length; i++) {
                if (urlData[i] == undefined || urlData[i] == null || urlData[i] == "") {
                    urlData[i] = "#";
                }
                shtml += ' <div class="swiper-slide">' + '    <a href="' + urlData[i] + '">' + '      <img class="swiper-lazy" data-src="' + HTTP_IMAGE_URL + imgageData[i] + '"  src="' + BASE_URL + '/static_v4/image/loadImg.jpg" alt="" >' + "    </a>" + " </div>";
            }
            var slideHtml = '<section class="cateListSwiper">' + '   <div class="swiper-container js_silderImg js_viewImgBox">' + '       <div class="swiper-wrapper">' + shtml + "       </div>" + '       <div class="swiper-pagination js_pagin"></div>' + "   </div>" + "</section>";
            return slideHtml;
        },
        // 广告轮播图轮播
        swiperAds: function(objArea, objPagin) {
            var indexSwiperAD = [];
            objArea.each(function(i) {
                if (indexSwiperAD[i] == undefined || indexSwiperAD[i] === "") {
                    if (objArea.eq(i).find(".swiper-slide").length < 2) {
                        indexSwiperAD = objArea.eq(i).swiper({
                            pagination: objPagin.eq(i),
                            loop: false,
                            autoplay: 2e3,
                            autoplayDisableOnInteraction: false,
                            lazyLoading: true
                        });
                        // 去掉轮播图下边的点
                        objPagin.removeClass("swiper-pagination-bullets");
                    } else {
                        indexSwiperAD = objArea.eq(i).swiper({
                            pagination: objPagin.eq(i),
                            loop: true,
                            autoplay: 2e3,
                            autoplayDisableOnInteraction: false,
                            lazyLoading: true
                        });
                    }
                } else {
                    indexSwiperAD[i].onResize();
                }
            });
        },
        // 推荐图片展示代码拼接
        commHtml: function(imgageData, urlData) {
            var _this = this;
            var shtml = "";
            for (var i = 0; i < imgageData.length; i++) {
                if (urlData[i] == undefined || urlData[i] == null || urlData[i] == "") {
                    urlData[i] = "#";
                }
                shtml += ' <a href="' + urlData[i] + '">' + '    <div class="commImg">' + '      <img class="js_lazyImg" data-echo="' + HTTP_IMAGE_URL + imgageData[i] + '"  src="' + BASE_URL + '/static_v4/image/loadImg.jpg" alt="" >' + "    </div>" + " </a>";
            }
            var slideHtml = '<section class="commTructImg">' + shtml + "</section>";
            return slideHtml;
        },
        // 可以请求轮播图的情况
        askForDataLimit: function(index, materialId, isSplit, fn) {
            var _this = this;
            if (isSplit) {
                if (materialId != null && materialId != "" && materialId != undefined) {
                    _this.getSliderData(index, materialId);
                    // 请求分类页面轮播图
                    if (fn) fn();
                }
            } else {
                var oWrapperPage = $(".js_wrapperPage").eq(index);
                if (_this.swiperImg.length > 0) {
                    if (materialId != -1) {
                        oWrapperPage.find(".js_cateSliderImg").eq(0).append(_this.sliderHtml(_this.swiperImg, _this.swiperImgUrl));
                        clearTimeout(_this.setSwiperTime);
                        _this.setSwiperTime = setTimeout(function() {
                            var oSwiperArea = oWrapperPage.find(".js_silderImg");
                            //广告轮播框
                            var oSwiperPagin = oWrapperPage.find(".js_pagin");
                            //个数点
                            _this.swiperAds(oSwiperArea, oSwiperPagin);
                        }, 300);
                    }
                }
            }
        }
    };
    var cateData = {
        allCateData: null,
        // 记录请求回来的数据
        totalSwiperNum: [],
        // 总滑动的页数
        startNum: [],
        // 每个小类的开始加载数
        endNum: [],
        //  每个小类的结束加载数
        limitNum: 12,
        // 每次加载的个数
        pageArr: [],
        // 页数
        catePageNum: 0,
        // 最新的左侧滚动索引
        cateSlideNum: 0,
        // 最新的swiper所滑动到的索引
        arrNum: [],
        // 每个slider的页码数
        getDataList: function(index, categorySign, categoryId, fn) {
            var _this = this;
            var url = "";
            var queryData = {};
            if (!rightOff) {
                url = loadChildCategoryUrl;
                queryData = {
                    parentSign: categorySign
                };
            } else {
                url = loadCategoryGoodsUrl;
                queryData = {
                    categoryId: categoryId,
                    start: 0,
                    limit: 200
                };
            }
            G_JSON_POST(url, queryData, function(data) {
                var noDataOff = true;
                if (data != null && data.length > 0) {
                    var dataLength = data.length;
                    var oWrapperPage = $(".js_wrapperPage").eq(index);
                    //获取总页数
                    //子分类页显示12个，分类列表页显示4个 当分类有轮播图时第一页显示9个
                    if (!rightOff) {
                        if (sliderData.swiperImgData[index]) {
                            if (dataLength > 9) {
                                _this.limitNum = 12;
                                _this.totalSwiperNum[index] = Math.ceil((parseInt(dataLength) - 9) / _this.limitNum) + 1;
                            } else {
                                _this.totalSwiperNum[index] = 1;
                            }
                        } else {
                            _this.limitNum = 12;
                            _this.totalSwiperNum[index] = Math.ceil(parseInt(dataLength) / _this.limitNum);
                        }
                    } else {
                        _this.limitNum = 5;
                        _this.totalSwiperNum[index] = Math.ceil(parseInt(dataLength) / _this.limitNum);
                    }
                    // 点击侧边导航加载数据时让页面下部的“向左滑会有更多精彩哦~”在空数据或者最后一页不显示
                    var navNum = $(".js_categorysNavList li").length;
                    for (var i = 0; i < navNum; i++) {
                        _this.arrNum[i] = _this.totalSwiperNum[i];
                    }
                    if (_this.totalSwiperNum[index] <= 1) {
                        oTurnLeftGuide.hide();
                    } else {
                        oTurnLeftGuide.show();
                    }
                    // 加载多少个slide
                    cateList.appendWrapperNum(index, _this.totalSwiperNum[index]);
                    // 要添加的内容
                    var cateSlidePage = oWrapperPage.find(".js_slidePageScroll");
                    cateList.appendCategoryGoods(data, _this.totalSwiperNum[index], index, cateSlidePage, rightOff, categorySign);
                    cateList.appendSlide();
                    if (!rightOff) {
                        myPub.SetImgHeight(oWrapperPage);
                    }
                } else {
                    oTurnLeftGuide.hide();
                    noDataOff = false;
                    _this.totalSwiperNum[index] = 1;
                    cateList.appendWrapperNum(index, _this.totalSwiperNum[index]);
                }
                if (fn) fn(noDataOff);
            }, function() {}, function() {});
        },
        // 历史数据定位
        HistoryInit: function(fn1, fn2) {
            var _this = this;
            _this.GetSessionData();
            cateList.updateShowCon(_this.catePageNum, _this.cateSlideNum, _this.arrNum);
            if (fn2) fn2();
        },
        // 设置历史定位
        SetSession: function() {
            var _this = this;
            if (!rightOff) {
                sessionStorage.setItem("catePageNum", _this.catePageNum);
                sessionStorage.setItem("cateSlideNum", _this.cateSlideNum);
                sessionStorage.setItem("arrNum", _this.arrNum);
            } else {
                sessionStorage.setItem("cateDetPageNum", _this.catePageNum);
                sessionStorage.setItem("cateDetSlideNum", _this.cateSlideNum);
                sessionStorage.setItem("arrNetNum", _this.arrNum);
            }
        },
        // 记录数据历史数据
        GetSessionData: function() {
            var _this = this;
            var catePageNum = 0, cateSlideNum = 0, arrNum = [], indexNum;
            if (!rightOff) {
                if (sessionStorage.getItem("catePageNum") != null) {
                    catePageNum = sessionStorage.getItem("catePageNum");
                    cateSlideNum = sessionStorage.getItem("cateSlideNum");
                    arrNum = sessionStorage.getItem("arrNum");
                }
            } else {
                if (sessionStorage.getItem("cateDetPageNum") != null) {
                    catePageNum = sessionStorage.getItem("cateDetPageNum");
                    cateSlideNum = sessionStorage.getItem("cateDetSlideNum");
                    arrNum = sessionStorage.getItem("arrNetNum");
                }
            }
            _this.catePageNum = parseInt(catePageNum);
            //设置页面的数据
            _this.cateSlideNum = parseInt(cateSlideNum);
            if (arrNum && arrNum.length > 0) {
                indexNum = arrNum.split(",");
            } else {
                return;
            }
            _this.arrNum = indexNum;
        }
    };
    var cateList = {
        oSlideGoodsBox: [],
        loadOff: [],
        // 加载开关
        navListNames: [],
        // 导航数据
        // 初始化
        cateInit: function(bOff) {
            if (bOff) {
                oContain.css({
                    "padding-top": oHeader.outerHeight(true),
                    "padding-bottom": oFooter.outerHeight(true)
                });
                lazLoading.AddLazLoadingImg(oWrap[0]);
                if (oSildeNavJRoll.obj === undefined) {
                    return;
                } else {
                    oSildeNavJRoll.ReScroll();
                }
            }
        },
        // 更新记录时调用
        updateShowCon: function(navLiNum, conNum, arr) {
            var $this = this;
            var activeLi = $(".js_categorysNavList").find("li");
            var _navDis = activeLi.eq(navLiNum).position().top;
            activeLi.removeClass("active").eq(navLiNum).addClass("active");
            //显示对应的导航
            var categorySign = activeLi.eq(navLiNum).attr("data-categorySign");
            var categoryId = activeLi.eq(navLiNum).attr("data-categoryId");
            var materialId = activeLi.eq(navLiNum).attr("data-materialId");
            oSildeNavJRoll.ScrollTo(0, -_navDis);
            sliderData.askForDataLimit(navLiNum, materialId, true, function() {
                cateList.loadOff[navLiNum] = false;
            });
            setTimeout(function() {
                var _oCategorysDetail = oCategorysBox.find(".js_categorysDetail");
                //显示对应的内容
                _oCategorysDetail.hide().eq(navLiNum).show();
                cateData.getDataList(navLiNum, categorySign, categoryId, function(bOff) {
                    // 有数据才执行
                    if (bOff) {
                        $this.oSlideGoodsBox[navLiNum].slideTo(conNum, 300, true);
                        // if(conNum == 0) {
                        //     // 数据统计
                        //     ddjAction.viewGoods(_oCategorysDetail.eq(navLiNum).find('.js_goodsList').eq(conNum), navLiNum);
                        // }
                        // 有本地存储时让页面下部的“向左滑会有更多精彩哦~”在空数据或者最后一页不显示
                        if (arr[navLiNum] == conNum + 1) {
                            oTurnLeftGuide.hide();
                        } else {
                            oTurnLeftGuide.show();
                        }
                    } else {
                        oTurnLeftGuide.hide();
                    }
                    cateList.loadOff[navLiNum] = false;
                    // 4秒后 导航收起
                    cateList.NavHideTimer();
                    if (sliderData.swiperImgData[navLiNum]) {
                        // 请求分类页面轮播图
                        sliderData.askForDataLimit(navLiNum, materialId, false);
                    }
                });
            }, 300);
        },
        // 把请求回来的数据给每个slider加上内容
        appendCategoryGoods: function(data, allNum, index, slideObj, rightOff, categorySign, fn) {
            var $this = this;
            for (var i = 0; i < allNum; i++) {
                if (cateData.pageArr[index] >= cateData.totalSwiperNum[index] + 1) {
                    return;
                } else {
                    cateData.startNum[index] = cateData.endNum[index];
                    if (sliderData.swiperImgData[index]) {
                        if (i == 0) {
                            cateData.endNum[index] = cateData.pageArr[index] * 9;
                        } else {
                            cateData.endNum[index] = cateData.pageArr[index] * cateData.limitNum;
                        }
                    } else {
                        cateData.endNum[index] = cateData.pageArr[index] * cateData.limitNum;
                    }
                    if (cateData.endNum[index] > data.length) {
                        cateData.endNum[index] = data.length;
                    }
                    if (!rightOff) {
                        slideObj.eq(i).append($this.leftLoadingHtmlUl(data, cateData.startNum[index], cateData.endNum[index], categorySign));
                    } else {
                        slideObj.eq(i).append($this.leftLoadingHtmlGoods(data, cateData.startNum[index], cateData.endNum[index], categorySign));
                    }
                    cateData.pageArr[index]++;
                    if (fn) fn();
                }
            }
        },
        // 设置导航
        SetNavList: function() {
            var _this = this;
            var _list = oCategorysNavList.find("ul").find("li");
            var length = _list.length;
            var isCommend = _list.eq(0).hasClass("js_careCommend");
            var shtmlBox = "";
            var shtmlCommend = "";
            for (var i = 0; i < length; i++) {
                _this.navListNames.push(_list.eq(i).text());
                cateData.startNum.push(0);
                cateData.endNum.push(0);
                cateData.pageArr.push(1);
                _this.loadOff.push(true);
                if (i == 0 && isCommend) {
                    shtmlCommend = '<div class="js_commend commend"></div>';
                } else {
                    shtmlCommend = "";
                }
                shtmlBox += '<div class="categorysDetail js_categorysDetail" style="display: none;">' + '   <div class="swiper-container js_swiperContainer">' + '       <div class="swiper-wrapper js_wrapperPage">' + shtmlCommend + "</div>" + "   </div>" + "</div>";
            }
            // 设置产品容器
            oCategorysBox.append(shtmlBox);
            // 导航加滚动
            oSildeNavJRoll.AddScroll(oCategorysNavList[0]);
            // 导航操作时 清除4秒收起的定时器
            oSildeNavJRoll.ScrollStart(function() {
                _this.NavShowTimer();
            });
            oSildeNavJRoll.ScrollEnd(function() {
                _this.NavHideTimer();
            });
        },
        // 加入 swiper-slide
        appendWrapperNum: function(index, appendNum) {
            var shtml = "";
            var $sWraper = $(".js_wrapperPage").eq(index);
            for (var i = 0; i < appendNum; i++) {
                shtml += '<div class="swiper-slide js_slidePageScroll"></div>';
            }
            $sWraper.append(shtml);
        },
        // 调用swiper
        appendSlide: function() {
            var oGoodsBox = oCategorysBox.find(".js_swiperContainer");
            var $this = this;
            //循环绑定swiper
            oGoodsBox.each(function(i) {
                if ($this.oSlideGoodsBox[i] === undefined) {
                    $this.oSlideGoodsBox[i] = oGoodsBox.eq(i).swiper({
                        pagination: null,
                        lazyLoading: true,
                        lazyLoadingInPrevNextAmount: 1,
                        touchAngle: 20,
                        keyboardControl: true,
                        touchControl: true,
                        onInit: function(swiper) {},
                        onSlideChangeEnd: function(swiper) {
                            var index = swiper.activeIndex;
                            // 隐藏除当前外的slider
                            oGoodsBox.eq(i).find(".js_slidePageScroll .js_goods_showOne").hide().eq(index).show();
                            // 同步滑动的slider
                            cateData.cateSlideNum = index;
                            cateList.NavHideTimer();
                            cateData.SetSession();
                            // 数据统计
                            // ddjAction.viewGoods(oGoodsBox.eq(i).find('.js_goodsList').eq(index), i);
                            if (cateData.arrNum[i] > 1) {
                                if (cateData.arrNum[i] == index + 1) {
                                    oTurnLeftGuide.hide();
                                } else {
                                    oTurnLeftGuide.show();
                                }
                            }
                        }
                    });
                } else {
                    $this.oSlideGoodsBox[i].onResize();
                }
            });
        },
        // 每个当前页面的内容
        leftLoadingHtmlUl: function(data, startNum, endNum, categorySign) {
            var shtmlBox = "";
            var shtml = "";
            for (var i = startNum; i < endNum; i++) {
                var dataItem = data[i];
                shtml += '<li class="js_eachProLi jsCategoryRightNav">' + '    <a class="js_appHref jsHrefCategory" data-curIdx="' + i + '" href="' + BASE_URL + "/category/categoryGoods?parentSign=" + categorySign + '" data-growing-title="' + dataItem.name + '">' + "        <figure>" + '            <img class="swiper-lazy"  data-src="' + HTTP_IMAGE_URL + dataItem.categoryImgPath + smallImgArg200 + '"  src="' + BASE_URL + '/static_v4/image/loadImg.jpg" alt=""  data-growing-title="' + dataItem.name + '">' + "        </figure>" + '        <aside class="priceArea">' + '            <div class="priceArea_name">' + "                <h4>" + dataItem.name + "</h4>" + "            </div>" + "        </aside>" + "    </a>" + "</li>";
            }
            shtmlBox = '<div class="categorysGoods js_categorysGoods">' + '    <div class="categorysGoods goodsList ListgoodsList ">' + '        <div class="js_cateSliderImg"></div>' + '        <ul class="clearfix">' + shtml + "        </ul>" + "    </div>" + "</div>";
            return shtmlBox;
        },
        leftLoadingHtmlGoods: function(data, startNum, endNum) {
            var shtml = "";
            for (var i = startNum; i < endNum; i++) {
                var dataItem = data[i];
                //全额保障  选择性显示哪些右上角图标
                var html_firstGueeImagePath = "";
                var firstGueeImagePath = dataItem.firstGueeImagePath;
                if (firstGueeImagePath != null && firstGueeImagePath != "") {
                    var gueeUrl = firstGueeImagePath;
                    html_firstGueeImagePath = '<div class="quanpei"><img src="' + gueeUrl + '" alt="" /></div>';
                }
                var html_goodsLabels = "";
                if (dataItem.goodsLabels && dataItem.goodsLabels != "") {
                    html_goodsLabels = '<i class="promotionHotIcon">' + dataItem.goodsLabel + "</i>";
                }
                var html_isTuangou = "";
                if (dataItem.isTuangou) {
                    html_isTuangou = '<span class="goodsPrice">￥' + dataItem.tuangouPrices + "</span>" + '<span class="tuangouNum">/<span>￥' + dataItem.salePrice + "</span></span>";
                } else {
                    html_isTuangou = '<span class="goodsPrice">￥' + dataItem.salePrice + "</span>";
                }
                var html_label = "";
                if (dataItem.label && dataItem.label != "") {
                    html_label += '<p class="promotionSale">';
                    for (var j = 0; j < dataItem.labels.length; j++) {
                        html_label += "<i>" + dataItem.labels[j] + "</i>";
                    }
                    html_label += "</p>";
                }
                shtml += "<li>" + '   <a class="BoxSelf" href="' + BASE_URL + "/h/goodspay/goodsView/" + dataItem.goodsSn + '" data-growing-title="' + dataItem.name + '" goodsid="' + data[i].id + '" >' + "       <figure>" + '           <img class="swiper-lazy" data-src="' + HTTP_IMAGE_URL + dataItem.showImage + smallImgArg200 + '" src="' + BASE_URL + '/static_v4/image/loadImg.jpg"  data-growing-title="' + dataItem.name + '"/>' + html_firstGueeImagePath + "       </figure>" + '      <aside class="priceArea VBox Bflex1">' + '           <div class="Bflex1 priceArea_name">' + "               <h4>" + html_goodsLabels + dataItem.name + "</h4>" + '               <p class="smallFont_tip">' + dataItem.title + "</p>" + "           </div>" + '           <div class="priceArea_price">' + // '               <i class="tip-info">买一送一</i>'+
                '               <p class="HBox priceAreaBox">' + html_isTuangou + // '                  <span class="goodsSpecNum">/' + dataItem.productName + '</span>'+
                "               </p>" + "           </div>" + "       </aside>" + "   </a>" + '   <p class="addCar js_addCar" pid="' + dataItem.productId + '"><em class="icon-shopcar_small"></em></p>' + html_label + //'   <p class="promotionSale horpromotionSale"><i>限时立减150</i><i>第二件半价</i></p>'+
                "</li>";
            }
            var shtmlBox = '<div class="categorysListGoods">' + '    <div class="goods_showChangeBox js_goods_showOne ">' + '        <div class="goods_showChange">' + '            <ul class="goodsList clearfix js_goodsList">' + shtml + "           </ul>" + "       </div>" + "   </div>" + "</div>";
            return shtmlBox;
        },
        // 导航展开和收缩
        NavAnimate: function(off) {
            if (off) {
                // 展开
                oCategorysNavList.stop().animate({
                    left: 0
                }, 300);
                oCategorysBox.stop().animate({
                    "margin-left": "6.9rem"
                }, 300, function() {
                    cateList.appendSlide();
                });
            } else {
                // 收起
                oCategorysNavList.stop().animate({
                    left: "-6.9rem"
                }, 300);
                oCategorysBox.stop().animate({
                    "margin-left": 0
                }, 300, function() {
                    cateList.appendSlide();
                });
            }
        },
        // 导航添加4秒倒计时隐藏
        NavHideTimer: function() {
            // 检测有收起按钮时 才加定时器
            if (oCategorysNavControl.length > 0 && !oCategorysNavControl.hasClass("on")) {
                clearTimeout(oCategorysNav_time);
                oCategorysNav_time = setTimeout(function() {
                    oCategorysNavControl.addClass("on");
                    cateList.NavAnimate(false);
                }, 4e3);
            }
        },
        // 导航显示
        NavShowTimer: function() {
            clearTimeout(oCategorysNav_time);
            oCategorysNavControl.removeClass("on");
        }
    };
    // 用户行为
    var ddjAction = {
        viewData: [],
        viewGoods: function(obj, iNow) {
            // 首页和分类区分
            var ddjActionPositionId = {};
            ddjActionPositionId.positionId = 2;
            ddjActionPositionId.positionFirst = "分类";
            ddjActionPositionId.positionSecond = cateList.navListNames[iNow];
            // 统计曝光数据
            visualArea.viewEl.showViewEls(obj, function(data, dataJson) {
                ddjhoc.setData(data, "rec_show", "add", function() {
                    console.log("ddjhoc.params.rec_show.cate", ddjhoc.params);
                    if (ddjhoc.params.length != 0) ddjhoc.sendData(ddjhoc.params);
                    console.log("ddjhoc.ddjParams.rec_show.cate", ddjhoc.ddjParams);
                    if (ddjhoc.ddjParams.length != 0) ddjhoc.sendDDJData(ddjhoc.ddjParams);
                }, dataJson, ddjActionPositionId);
            });
        }
    };
});
define("static_v4/js/mod/historyCookie", [ "./public", "../plug/base64" ], function(require, exports, module) {
    var myPub = require("./public");
    var base64 = require("../plug/base64");
    // 搜索设置cookie
    var cTime = "d7";
    // coookie 时间
    var _val = [];
    var oMessageIcon = $(".js_messageIcon");
    // 首页消息图标
    var oSearchBox = $(".js_searchBox");
    // 搜索区域
    var oSearchRecom = $(".js_searchRecom");
    // 搜索推荐
    var oSearchBtn = $(".js_searchBtn");
    // 搜索按钮
    var oSearchTxt = $(".js_searchTxt");
    // 搜索框
    var oHClearBtn = $(".js_HClearBtn");
    // 清楚历史记录按钮
    var oHisListUl = $(".js_hisList").find("ul");
    // 历史记录UL
    var recomHTMl = oHisListUl.html();
    // 系统推荐
    var cookArry = document.cookie.split("; ");
    // 分离cookie成数组
    var cookIndex = parseInt(myPub.getCookie("cookIndex"));
    // 记录个数
    var oShadow = $(".js_shadow");
    // 阴影
    var oHotList = $(".js_hotList");
    // 热门列表
    var oClearBtn = $(".js_clearBtn");
    // 清除按钮
    var oSearchForm = $("#searchForm");
    // 提交的表单
    var oMessageIconHrefBtn = $(".js_messageIconHrefBtn");
    // 弹层搜索按钮
    var oShowSearchBox = $(".js_showSearchBox");
    // 搜索图标按钮
    var maxCookieNum = 4;
    var oClearSearchAndCover = $(".js_clearSearchAndCover");
    // 搜索推荐信息
    var oSearchRecomBox = $(".js_searchRecomBox");
    // 搜索提示
    var oSearchHrefList = $(".js_searchHrefList");
    var jArgList = {
        suggestStr: "",
        // 'start': 1,
        limit: 10
    };
    //取消滑动 
    oSearchRecom.on("touchmove", function(e) {
        e.preventDefault();
    });
    oSearchTxt.on("input propertychange", function() {
        if (oSearchTxt.val() !== "") {
            oSearchRecomBox.hide();
            oSearchHrefList.show();
            jArgList.suggestStr = oSearchTxt.val();
            getSearchList(jArgList);
        } else {
            oSearchRecomBox.show();
            oSearchHrefList.hide();
        }
    });
    // 搜多推荐列表点击
    oSearchHrefList.hammer().on("tap", function(e) {
        var _tag = e.gesture.target;
        var target, tarTxt;
        _tag.nodeName.toLowerCase() == "li" ? target = $(_tag) : target = $(_tag).parents("li");
        tarTxt = target.text();
        if (!tarTxt) return; else {
            oSearchTxt.val(target.text());
            oClearBtn.show();
            JumpSearchPage("", false, false, target.text(), false);
        }
        myPub.HamstopPropaga();
        e.stopPropagation();
    });
    oSearchTxt.on("focus", function() {
        //oMessageIcon.hide();
        oSearchRecom.show();
        oShadow.show().css({
            top: oSearchBox.outerHeight(true)
        });
    });
    /*oSearchTxt.on('blur', function () {
        //oMessageIcon.show();
        oSearchRecom.hide();
        oShadow.hide().css({'top': 0});
    });*/
    // 弹层消息按钮点击跳转
    oMessageIconHrefBtn.hammer().on("tap", function() {
        var _href = oMessageIconHrefBtn.find("a").attr("href");
        myPub.locationHref(_href);
    });
    $("#form").submit(function() {
        return false;
    });
    // 搜索图标按钮点击
    oShowSearchBox.on("click", function(e) {
        oSearchRecom.show();
        oSearchTxt.focus();
        e.stopPropagation();
    });
    // 阴影关闭
    oShadow.on("click", function(e) {
        //失去焦点
        oSearchTxt.blur();
        oSearchRecom.hide();
        oShadow.hide();
        e.stopPropagation();
    });
    oClearSearchAndCover.on("click", function(e) {
        //失去焦点
        oSearchTxt.blur();
        oSearchRecom.hide();
        oShadow.hide();
        e.stopPropagation();
    });
    oClearBtn.hammer().on("tap", function(e) {
        oSearchRecomBox.show();
        oSearchHrefList.hide();
        myPub.HamstopPropaga();
        e.stopPropagation();
    });
    // // 获取cookie并设置历史记录
    // if (myPub.getCookie('cookIndex') == undefined || myPub.getCookie('cookIndex') == -1) {
    //     myPub.setCookie('cookIndex', '-1', cTime);
    //     cookIndex = parseInt(myPub.getCookie('cookIndex'));
    // }
    // else {
    //     oHisListUl.empty();
    //     for (var i = 0; i < cookArry.length; i++) {
    //         if (cookArry[i].charAt(0) == 'r') {
    //             _val[i] = cookArry[i].substring(cookArry[i].indexOf('=') + 1);
    //             oHisListUl.prepend('<li><span>' + unescape(_val[i]) + '</span></li>');
    //         }
    //     }
    // }
    // 获取cookie并设置历史记录
    var searchListBase64 = myPub.getCookie("searchList");
    if (searchListBase64 != null && searchListBase64 != "") {
        var searchList = JSON.parse(base64.decode(searchListBase64));
        var searchLength = searchList.slice(-5);
        // 历史搜索记录最新搜索的0~5个记录
        var maxNumber = Math.min(5, searchList.length);
        // 历时搜索记录里最多有5个
        for (var i = 0; i < maxNumber; i++) {
            var obj = searchLength[i];
            if (obj.isLink) {
                if (obj.isSign) oHisListUl.prepend('<li><span class="active" data-type="yes" data-id="' + obj.link + '">' + obj.word + "</span></li>"); else oHisListUl.prepend('<li><span data-type="yes" data-id="' + obj.link + '">' + obj.word + "</span></li>");
            } else {
                if (obj.isSign) oHisListUl.prepend('<li><span class="active">' + obj.word + "</span></li>"); else oHisListUl.prepend("<li><span>" + obj.word + "</span></li>");
            }
        }
    }
    // 搜索后添加cookie
    // oSearchBtn.hammer().on('tap', function () {
    //     JumpSearchPage();
    // });
    //键盘事件
    $(document).keydown(function(event) {
        if (event.keyCode == 13) {
            var keyword = $("#keyword");
            var isLink = keyword.attr("data-id");
            var h5link = keyword.attr("data-type");
            var searchWord = keyword.attr("placeholder");
            var input = keyword.val();
            var saveJson = {
                word: input,
                isLink: false,
                link: "../../shop/goods/tosearchv3?keyword=" + input,
                isSign: false
            };
            // 保存搜索历史到cookie
            if (input == "") {
                saveJson.word = searchWord;
                if (isLink == "true") {
                    saveJson.isLink = true;
                    saveJson.link = h5link;
                } else {
                    saveJson.link = "../../shop/goods/tosearchv3?keyword=" + searchWord;
                }
            }
            saveHistory(saveJson);
            // userAction(keyword, saveJson.word);
            window.location.href = saveJson.link;
        }
    });
    // 清除cookie和历史记录
    oHClearBtn.hammer().on("tap", function() {
        //失去焦点
        oSearchTxt.blur();
        myPub.askLayer("亲！您确定要清除历史记录？", function() {
            // for (var i = 0; i < cookArry.length; i++) {
            //     myPub.delCookie('records' + i);
            // }
            // myPub.delCookie('cookIndex');
            // // 清楚cookie的记录 添加系统推荐的
            // oHisListUl.empty().html(recomHTMl);
            clearHistory();
            myPub.LayerCloseAll();
        }, function() {
            myPub.LayerCloseAll();
        }, "no");
    });
    //热门搜索点击
    oHotList.hammer().on("tap", function(e) {
        oSearchTxt.blur();
        var _tarTag = e.gesture.target;
        var target, tarTxt;
        _tarTag.nodeName.toLowerCase() == "li" ? target = $(_tarTag) : target = $(_tarTag).parents("li");
        tarTxt = target.find("span").text();
        if (!tarTxt) return; else {
            oSearchTxt.val(tarTxt);
            oClearBtn.show();
            var isLink = target.find("span").attr("data-type"), link = target.find("span").attr("data-id"), isActive = target.find("span").hasClass("active");
            JumpSearchPage("hotwords", isLink, link, tarTxt, isActive);
        }
        myPub.HamstopPropaga();
        e.stopPropagation();
    });
    // 历史记录搜索点击
    oHisListUl.hammer().on("tap", function(e) {
        oSearchTxt.blur();
        var _tarTag = e.gesture.target;
        var target, tarTxt;
        _tarTag.nodeName.toLowerCase() == "li" ? target = $(_tarTag) : target = $(_tarTag).parents("li");
        tarTxt = target.find("span").text();
        if (!tarTxt) return; else {
            oSearchTxt.val(tarTxt);
            oClearBtn.show();
            var isLink = target.find("span").attr("data-type"), link = target.find("span").attr("data-id"), isActive = target.find("span").hasClass("active");
            JumpSearchPage("", isLink, link, tarTxt, isActive);
        }
        myPub.HamstopPropaga();
        e.stopPropagation();
    });
    // 跳转搜索结果
    function JumpSearchPage(searchType, isLink, link, text, isActive) {
        var keyword = $("#keyword");
        // if (oSearchTxt.val() == '') {
        //     //myPub.TipLayer('亲！搜索信息不能为空！');
        //     /oSearchFormSub();
        // }
        // else if (oSearchTxt.val().indexOf('<') > 0 || oSearchTxt.val().indexOf('>') > 0) {
        //     return
        // }
        // 检测是否有相同的产品
        // for (var i = 0; i < maxCookieNum; i++) {
        //     if (oSearchTxt.val() == myPub.getCookie('records' + i)) {
        //         //console.log('有相同名字')
        //         oSearchFormSub();
        //         return;
        //     }
        //
        // }
        // cookIndex == null || cookIndex >= maxCookieNum ? cookIndex = 0 : cookIndex++;
        // myPub.setCookie('records' + cookIndex, oSearchTxt.val(), cTime);
        // myPub.setCookie('cookIndex', cookIndex, cTime);
        var saveJson = {
            word: text,
            isLink: false,
            link: "../../shop/goods/tosearchv3?keyword=" + text,
            isSign: isActive
        };
        if (isLink == "yes") {
            saveJson.isLink = true;
            saveJson.link = link;
        }
        saveHistory(saveJson);
        // userAction(keyword, saveJson.word);
        window.location.href = saveJson.link;
    }
    //延迟提交
    function oSearchFormSub() {
        var subTime;
        clearTimeout(subTime);
        subTime = setTimeout(function() {
            oSearchForm.submit();
        }, 300);
    }
    function saveHistory(obj) {
        var searchListBase64 = myPub.getCookie("searchList"), searchList = [], finalList = [];
        if (searchListBase64 == null || searchListBase64 == "") searchList = []; else searchList = JSON.parse(base64.decode(searchListBase64));
        var isContain = false;
        for (var i = 0; i < searchList.length; i++) {
            if (searchList[i].word == obj.word) isContain = true;
        }
        if (isContain) return;
        searchList.push(obj);
        var jsonListBase64 = base64.encode(JSON.stringify(searchList));
        myPub.setCookie("searchList", jsonListBase64);
    }
    function clearHistory() {
        myPub.setCookie("searchList", "");
        oHisListUl.html("");
    }
    // 获取关键字
    function getSearchWord() {
        G_JSON_GET("/search/searchWord", "", function(response) {
            try {
                if (response.status == 200) {
                    $("#keyword").attr("placeholder", response.searchWord.name);
                    $("#keyword").attr("data-id", response.searchWord.searchType);
                    $("#keyword").attr("data-type", response.searchWord.h5link);
                }
            } catch (e) {}
        });
    }
    // 获取热门搜索数据
    function getHotWords() {
        G_JSON_GET("/search/hotWords", null, function(response) {
            try {
                if (response.length > 0) {
                    var list = response;
                    for (var i = 0; i < list.length; i++) {
                        var name = list[i].name, isSign = list[i].isSign, searchType = list[i].searchType, h5link = list[i].h5link;
                        if (isSign) {
                            if (searchType) $(".js_hotList").append('<li><span class="active" data-type="yes" data-id="' + h5link + '">' + name + "</span></li>"); else $(".js_hotList").append('<li><span class="active" data-type="no">' + name + "</span></li>");
                        } else {
                            if (searchType) $(".js_hotList").append('<li><span data-type="yes" data-id="' + h5link + '">' + name + "</span></li>"); else $(".js_hotList").append('<li><span data-type="no">' + name + "</span></li>");
                        }
                    }
                }
            } catch (e) {}
        });
    }
    // 获取搜索推荐
    function getSearchList(arg) {
        G_JSON_GET("/openSearch/doSuggest", arg, function(response) {
            var Data = JSON.parse(response.suggests);
            var _listUl = oSearchHrefList.find("ul");
            _listUl.html("");
            for (var i = 0; i < Data.length; i++) {
                _listUl.append("<li>" + Data[i].suggestion + "</li>");
            }
            if (Data.length == 0) {
                oSearchRecomBox.show();
                oSearchHrefList.hide();
            }
        });
    }
    // 添加用户行为
    function userAction(obj, keyword) {
        ddjhoc.setData(obj, "search", "add", function() {
            console.log("params.search", ddjhoc.params);
            ddjhoc.sendData(ddjhoc.params);
        }, keyword);
    }
    getHotWords();
    getSearchWord();
});
define("static_v4/js/mod/webcall_message", [], function(require, exports, module) {
    var webcallMsgDiv = $(".js_webcallMsg");
    $(function() {
        // 动态获取是否有新的消息
        $.ajax({
            url: "/365webcall/messageCount",
            type: "GET",
            dataType: "json",
            success: function(data) {
                if (data == true || data == "true") {
                    webcallMsgDiv.find("i").addClass("active");
                }
            },
            complete: function(XHR, TS) {
                XHR = null;
            }
        });
    });
});
var baseurl = "";

var smallImgArg = "?x-oss-process=style/goods_img_3";

var smallImgArg300 = "?x-oss-process=style/goods_img_2";

var smallImgArg200 = "?x-oss-process=style/goods_img";

function check_support_webp() {
    var isSupportWebp = document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp") == 0;
    return isSupportWebp;
}

if (check_support_webp()) {
    smallImgArg = "?x-oss-process=style/goods_webp_3";
    smallImgArg300 = "?x-oss-process=style/goods_webp_2";
    smallImgArg200 = "?x-oss-process=style/goods_webp";
}

define("static_v4/js/mod/public", [], function(require, exports, module) {
    //yx
    //var httpImageUrl="https://fm95338bucket.oss-cn-shenzhen.aliyuncs.com/";
    //zs
    //var httpImageUrl="https://sfddj-img-bucket.oss-cn-shenzhen.aliyuncs.com/";
    var httpImageUrl;
    var myDoMain = "";
    if (window.location.host == "m.sfddj.com" || window.location.host == "120.76.47.184" || window.location.host == "120.76.207.85" || window.location.host == "120.76.44.28") {
        // httpImageUrl="https://sfddj-img-bucket.oss-cn-shenzhen.aliyuncs.com/";
        httpImageUrl = "https://img.sfddj.com/";
        myDoMain = "https://m.sfddj.com";
    } else if (window.location.host == "hdm.sfddj.com") {
        httpImageUrl = "https://img.sfddj.com/";
        myDoMain = "https://hdm.sfddj.com";
    } else if (window.location.host == "itsm.sfddj.com") {
        // httpImageUrl="https://fm95338bucket.oss-cn-shenzhen.aliyuncs.com/";
        httpImageUrl = "https://img.fx-sf.com/";
        myDoMain = "https://itsm.sfddj.com";
    } else if (window.location.host == "shop.fx-sf.com") {
        // httpImageUrl="https://fm95338bucket.oss-cn-shenzhen.aliyuncs.com/";
        httpImageUrl = "https://img.fx-sf.com/";
        myDoMain = "https://shop.fx-sf.com";
    } else if (window.location.host == "www.shhyxypsx.com") {
        httpImageUrl = "https://img.fx-sf.com/";
        myDoMain = "https://www.shhyxypsx.com";
    } else if (window.location.hostname == "localhost") {
        httpImageUrl = "http://img-dev.sfddj.com/";
        myDoMain = "http://localhost:8082";
    }
    exports.httpImageUrl = httpImageUrl;
    exports.myDoMain = myDoMain;
    //加入购物车的动画
    function AddCarAnimate(_X, _Y, target, sLeft, sTop, offsetDis, callBack) {
        // var _X = e.gesture.center.x;
        // var _Y = e.gesture.center.y;
        var time = null;
        var timeTwo = null;
        target.removeClass("myRotateFast");
        target.css({
            left: _X,
            top: _Y,
            opacity: 1
        });
        clearTimeout(time);
        time = setTimeout(function() {
            target.addClass("myRotateFast").stop().animate({
                left: _X,
                top: _Y - 50,
                opacity: 1
            }, 300, function() {
                target.stop().animate({
                    left: sLeft,
                    top: sTop
                }, 600, function() {
                    target.removeClass("myRotateFast");
                    clearTimeout(timeTwo);
                    timeTwo = setTimeout(function() {
                        target.stop().animate({
                            top: sTop + offsetDis * 2,
                            opacity: 0
                        }, 200, function() {
                            if (callBack) callBack();
                        });
                    }, 200);
                });
            });
        }, 30);
    }
    exports.AddCarAnimate = AddCarAnimate;
    // hammer 冒泡
    function HamstopPropaga() {
        window.event.returnValue = false;
        return false;
    }
    exports.HamstopPropaga = HamstopPropaga;
    //hammer事件
    function HammerEvent(obj) {
        this.obj = obj;
    }
    HammerEvent.prototype.addHamEvent = function(obj, type, fn) {
        this.obj = new Hammer.Manager(obj);
        this.obj.add(new Hammer.Pan({
            velocity: 0,
            threshold: 120,
            direction: Hammer.DIRECTION_ALL
        }));
        //平滑
        this.obj.add(new Hammer.Swipe({
            threshold: 8,
            direction: Hammer.DIRECTION_ALL
        }));
        this.obj.add(new Hammer.Tap({}));
        this.obj.add(new Hammer.Press({
            velocity: .6,
            threshold: 8
        }));
        //长时间下压
        this.obj.off(type);
        this.obj.on(type, function(e) {
            if (fn) fn(e);
        });
    };
    exports.HammerEvent = HammerEvent;
    /* 数字验证 */
    function ValiNum(obj, fn1, fn2) {
        var reg = new RegExp("^[0-9]*$");
        if (!reg.test(obj.val())) {
            if (fn1) fn1();
        } else if (obj.val() <= 0) {
            // TipLayer("数量不能小余1");
            obj.val(1);
        } else {
            if (fn2) fn2();
        }
    }
    exports.ValiNum = ValiNum;
    /* 字数统计 */
    function statInputNum(textArea, numItem) {
        var max = [];
        var curLength = [];
        textArea.each(function(i) {
            max[i] = parseInt(numItem.eq(i).text());
            if (textArea.eq(i).val().length > 0) {
                curLength[i] = textArea.eq(i).val().length;
                numItem.eq(i).empty().text(max[i] - curLength[i]);
            }
            textArea.eq(i).attr("maxlength", max[i]).on("input propertychange", function() {
                curLength[i] = $(this).val().length;
                numItem.eq(i).empty().text(max[i] - curLength[i]);
            });
        });
    }
    exports.statInputNum = statInputNum;
    /* 购物车价格统计 */
    function ShopSumPrice(obj, tarFather, target, sumPrice) {
        var _price = 0;
        obj.each(function(i) {
            if (obj.eq(i).hasClass("active")) {
                var _oGoodsPrice = obj.eq(i).parents(tarFather).find(target);
                _oGoodsPrice.each(function(i) {
                    _price += _oGoodsPrice.eq(i).text() * 1;
                    return _price;
                });
            }
        });
        sumPrice.text(_price.toFixed(2));
    }
    exports.ShopSumPrice = ShopSumPrice;
    /*************** 弹框效果 s***************/
    //提示框
    function TipLayer(sCont, sStyle, fn, T) {
        layer.open({
            content: sCont,
            style: sStyle != "no" ? sStyle : "background-color:rgba(255,255,255,1); color:#252525; border:none; border-radius: 5px;",
            scrollbar: false,
            time: T || 2,
            shadeClose: false,
            success: function() {
                if (fn) fn();
            }
        });
        NoTouchMove($(".laymshade"));
    }
    exports.TipLayer = TipLayer;
    //提示框_没有遮罩层
    function TipLayer_noShade(sCont, sStyle, fn, T) {
        layer.open({
            content: sCont,
            style: sStyle != "no" ? sStyle : "background-color:rgba(255,255,255,1); color:#252525; border:none; border-radius: 5px;",
            scrollbar: false,
            time: T || 2,
            shade: false,
            shadeClose: false,
            success: function() {
                if (fn) fn();
            }
        });
        NoTouchMove($(".laymshade"));
    }
    exports.TipLayer_noShade = TipLayer_noShade;
    //框消失后执行回调提示框
    function TipLayerEnd(sCont, sStyle, fn, T) {
        layer.open({
            content: sCont,
            style: sStyle != "no" ? sStyle : "background-color:rgba(255,255,255,1); color:#252525; border:none; border-radius: 5px;",
            scrollbar: false,
            time: T || 2,
            shadeClose: false,
            end: function() {
                if (fn) fn();
            }
        });
        NoTouchMove($(".laymshade"));
    }
    exports.TipLayerEnd = TipLayerEnd;
    // 用户手动关闭弹框
    function TipLayerLong(sCont, sStyle) {
        layer.open({
            content: sCont,
            style: sStyle != "no" ? sStyle : "background-color:rgba(255,255,255,1); color:#252525; border:none; border-radius: 5px;",
            scrollbar: false,
            shadeClose: true
        });
        NoTouchMove($(".laymshade"));
    }
    exports.TipLayerLong = TipLayerLong;
    // 用户手动关闭弹框有关闭按钮
    function TipLayerLongClose(sTit, sCont, sStyle, fn) {
        layer.open({
            title: sTit != "no" ? sTit : "",
            content: sCont,
            style: sStyle != "no" ? sStyle : "background-color:rgba(255,255,255,1); color:#252525; border:none; border-radius: 5px;",
            scrollbar: false,
            shadeClose: true,
            closeBtn: 1,
            success: function() {
                if (fn) fn();
            }
        });
        NoTouchMove($(".laymshade"));
    }
    exports.TipLayerLongClose = TipLayerLongClose;
    //带按钮提示框
    function TipBtnLayer(sCont, sTit, btnName, yesFn, cancelFn, fn) {
        layer.open({
            title: sTit != "no" ? sTit : "",
            content: sCont,
            btn: btnName == undefined ? [ "确定" ] : [ btnName ],
            shadeClose: false,
            scrollbar: false,
            yes: function() {
                if (yesFn) yesFn();
                LayerCloseAll();
            },
            cancel: function() {
                if (cancelFn) cancelFn();
            },
            success: function() {
                if (fn) fn();
                $(".layermbtn span").css({
                    width: "100%"
                });
            }
        });
        NoTouchMove($(".laymshade"));
    }
    exports.TipBtnLayer = TipBtnLayer;
    // 标题提示框
    function TipTitleLayer(sTitle, styleTit, sCont, fn) {
        layer.open({
            title: [ sTitle, "background-color:#fff; color:#666; font-weight:bold" ],
            content: sCont,
            shadeClose: false,
            scrollbar: false,
            style: styleTit,
            cancel: function() {
                if (fn) fn();
            }
        });
        NoTouchMove($(".laymshade"));
    }
    exports.TipTitleLayer = TipTitleLayer;
    //询问层
    function askLayer(sCont, yesFn, noFn, sTit, callBack, aBtnName) {
        layer.open({
            //no 为没有标题 sTit为设置标题
            title: sTit != "no" ? sTit : "",
            content: sCont,
            btn: aBtnName == undefined ? [ "确认", "取消" ] : aBtnName,
            shadeClose: false,
            scrollbar: false,
            yes: yesFn,
            no: noFn,
            cancel: noFn,
            success: function() {
                if (callBack) callBack();
            }
        });
        NoTouchMove($(".laymshade"));
    }
    exports.askLayer = askLayer;
    // 关闭所有弹框
    function LayerCloseAll() {
        layer.closeAll();
    }
    exports.LayerCloseAll = LayerCloseAll;
    //加载层
    function loadLayer(cont) {
        layer.open({
            type: 2,
            content: cont,
            shadeClose: false
        });
        NoTouchMove($(".laymshade"));
    }
    exports.loadLayer = loadLayer;
    //防止滑动
    function NoTouchMove(obj) {
        obj.on("touchmove", function() {
            return false;
        });
    }
    exports.NoTouchMove = NoTouchMove;
    /*************** 弹框效果 e***************/
    //节流控制
    function throttle(method, context, time) {
        time == undefined ? time = 200 : time = time;
        //console.log(time)
        clearTimeout(method.tId);
        method.tId = setTimeout(function() {
            method.call(context);
        }, time);
    }
    exports.throttle = throttle;
    //s20是代表20秒 h是指小时，如12小时则是：h12 d是天数，30天则：d30
    //写cookies setCookie("name","hayden",'s20');
    function setCookie(name, value, time) {
        var strsec;
        if (time == undefined) {
            var Days = 30;
            //默认30天有效期
            strsec = Days * 24 * 60 * 60 * 1e3;
        } else {
            strsec = getsec(time) * 1;
        }
        var exp = new Date();
        exp.setTime(exp.getTime() + strsec);
        document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString() + ";path=/";
    }
    exports.setCookie = setCookie;
    //读取cookies getCookie("name")
    function getCookie(name) {
        var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
        if (arr = document.cookie.match(reg)) {
            return unescape(arr[2]);
        } else {
            return null;
        }
    }
    exports.getCookie = getCookie;
    //删除cookies delCookie('name')
    function delCookie(name) {
        var exp = new Date();
        exp.setTime(exp.getTime() - 1);
        var cval = getCookie(name);
        if (cval != null) document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString() + ";path=/";
    }
    exports.delCookie = delCookie;
    //设置cookie时间
    function getsec(str) {
        var str1 = str.substring(1, str.length) * 1;
        var str2 = str.substring(0, 1);
        if (str2 == "s") {
            return str1 * 1e3;
        } else if (str2 == "h") {
            return str1 * 60 * 60 * 1e3;
        } else if (str2 == "d") {
            return str1 * 24 * 60 * 60 * 1e3;
        }
    }
    /* 验证码倒计时 */
    function CutTime(time, fn1, fn2) {
        var _AllTime = time;
        var _T = null;
        clearInterval(_T);
        _T = setInterval(function() {
            if (time <= 0) {
                clearInterval(_T);
                if (fn1) fn1(_AllTime);
            } else {
                time--;
                if (fn2) fn2(time);
            }
        }, 1e3);
    }
    exports.CutTime = CutTime;
    /*手机号码验证*/
    function checkMobile(obj, fn1, fn2, fn3) {
        var oIphone = obj.val();
        var reg = /^(1[1|2|3|4|5|6|7|8|9])[\d]{9}$/;
        //验证手机号码
        if (oIphone == "") {
            if (fn1) fn1();
        } else if (!reg.test(oIphone)) {
            if (fn2) fn2();
        } else {
            if (fn3) fn3();
        }
    }
    exports.checkMobile = checkMobile;
    /*密码验证*/
    function checkPassWord(obj, fn1, fn2, fn3) {
        var _val = obj.val();
        var reg = /^[a-zA-Z0-9]{6,20}$/;
        //6-20位数字和英文
        if (_val == "") {
            if (fn1) fn1();
        } else if (!reg.test(_val)) {
            if (fn2) fn2();
        } else {
            if (fn3) fn3();
        }
    }
    exports.checkPassWord = checkPassWord;
    /*用户名验证*/
    function checkUserName(obj, fn1, fn2, fn3) {
        var _userName = obj.val();
        var reg = /^[A-Za-z\u4e00-\u9fa5][A-Za-z0-9\u4e00-\u9fa5]{1,9}$/;
        //验证用户名
        if (_userName == "") {
            if (fn1) fn1();
        } else if (!reg.test(_userName)) {
            if (fn2) fn2();
        } else {
            if (fn3) fn3();
        }
    }
    exports.checkUserName = checkUserName;
    //图片预加载(window)
    function lazLoadingImgEcho(obj, fn) {
        echo.init({
            container: obj,
            offset: 300,
            throttle: 50,
            //设置图片延迟加载的时间 
            callback: function(element, op) {
                if (fn) fn(element, op);
                // console.log(element, 'has been', op + 'ed')
                var $el = $(element);
                var sUl = $el.attr("src");
                loadImageCheck(sUl, function() {
                    $el.addClass("fadeIn");
                    $el = null;
                });
            }
        });
    }
    exports.lazLoadingImgEcho = lazLoadingImgEcho;
    function lazLoadingImg(obj) {
        this.obj = obj;
    }
    //添加图片预加载
    lazLoadingImg.prototype.AddLazLoadingImg = function(obj, fn) {
        this.obj = echoChangeByCc.initNew({
            container: obj,
            unload: false,
            offset: 300,
            throttle: 80,
            //设置图片延迟加载的时间
            callback: function(element, op) {
                var $el = $(element);
                var sUl = $el.attr("src");
                loadImageCheck(sUl, function() {
                    $el.addClass("fadeIn");
                    $el = null;
                });
                if (fn) fn();
            }
        });
    };
    // 图片预加载 销毁
    lazLoadingImg.prototype.DestroyLazLoadingImg = function() {
        var _this = this.obj;
        if (_this && _this.detach) {
            _this.detach();
        }
    };
    // 图片预加载 刷新
    lazLoadingImg.prototype.RushLazLoadingImg = function() {
        var _this = this.obj;
        _this.render();
    };
    function loadImageCheck(url, callback) {
        //创建一个Image对象，实现图片的预下载
        var img = new Image();
        img.src = url;
        // 如果图片已经存在于浏览器缓存，直接调用回调函数
        if (img.complete) {
            callback();
            img = null;
            return;
        }
        img.onload = function() {
            //图片下载完毕时异步调用callback函数。
            callback();
            img = null;
        };
    }
    exports.lazLoadingImg = lazLoadingImg;
    function lazLoadingImgEchoAbs(obj, fn) {
        echoChangeByCc.initNew({
            container: obj,
            unload: false,
            offset: 200,
            throttle: 30,
            //设置图片延迟加载的时间
            callback: function(element, op) {
                var $el = $(element);
                // console.log($el)
                var sUl = $el.attr("src");
                loadImageCheck(sUl, function() {
                    $el.addClass("fadeIn");
                    $el = null;
                });
                if (fn) fn();
            }
        });
    }
    exports.lazLoadingImgEchoAbs = lazLoadingImgEchoAbs;
    //mui插件事件开关
    function OffMuiEvent(arg) {
        mui.init({
            gestureConfig: {
                tap: arg,
                //默认为true
                swipe: arg
            }
        });
    }
    exports.OffMuiEvent = OffMuiEvent;
    //设置li图片高度 父级获取
    function SetImgHeight(obj, getWidth) {
        var htmlFontSize = $("html").css("font-size");
        var intSize = htmlFontSize.split("p")[0];
        var imgWidth = null;
        if (obj[0].nodeName.toLowerCase() === "li") {
            getWidth ? imgWidth = getWidth / intSize : imgWidth = obj.find("figure").eq(0).parents("a").width() / intSize;
            // obj.find('figure:not(:first)').css({'height': imgWidth+'rem', 'width': imgWidth+'rem'});
            obj.find("figure").css({
                height: imgWidth + "rem",
                width: imgWidth + "rem"
            });
        } else {
            getWidth ? imgWidth = getWidth / intSize : imgWidth = obj.find("li figure").eq(0).parents("a").width() / intSize;
            // obj.find('li figure:not(:first)').css({'height': imgWidth+'rem', 'width': imgWidth+'rem'});
            obj.find("li figure").css({
                height: imgWidth + "rem",
                width: imgWidth + "rem"
            });
        }
    }
    exports.SetImgHeight = SetImgHeight;
    // 日期 2015-09-01 11:16:00
    function FormatDateTime(date, minType, point) {
        var y = date.getFullYear();
        var m = date.getMonth() + 1;
        m = m < 10 ? "0" + m : m;
        var d = date.getDate();
        d = d < 10 ? "0" + d : d;
        var h = date.getHours();
        h = h < 10 ? "0" + h : h;
        var minute = date.getMinutes();
        minute = minute < 10 ? "0" + minute : minute;
        var seconds = date.getSeconds();
        seconds = seconds < 10 ? "0" + seconds : seconds;
        var _sep = "-";
        if (point) _sep = point;
        // 最小到天
        if (minType == "minDay") {
            return y + _sep + m + _sep + d;
        } else if (minType == "minMinute") {
            return y + _sep + m + _sep + d + " " + h + ":" + minute;
        } else {
            return y + _sep + m + _sep + d + " " + h + ":" + minute + ":" + seconds;
        }
    }
    exports.FormatDateTime = FormatDateTime;
    /*************** 滚动条效果 s***************/
    function ScrollBar(obj) {
        this.obj = obj;
    }
    //添加滚动条
    ScrollBar.prototype.AddScroll = function(obj, sOptions) {
        this.obj = new JRoll(obj, sOptions);
    };
    //刷新滚动条
    ScrollBar.prototype.ReScroll = function(fn) {
        var _this = this.obj;
        _this.refresh();
        if (fn) fn();
    };
    //删除滚动条
    ScrollBar.prototype.DelScroll = function(fn) {
        var _this = this.obj;
        _this.destroy();
        if (fn) fn();
    };
    //滚动 到 0
    ScrollBar.prototype.ScrollTo = function(x, y, time, fn) {
        var _this = this.obj;
        _this.scrollTo(x, y, time, false, function() {
            if (fn) fn(_this);
        });
    };
    //滚动开始事件
    ScrollBar.prototype.ScrollStart = function(fn) {
        var _this = this.obj;
        _this.on("scrollStart", fn);
    };
    //滚动结束事件
    ScrollBar.prototype.ScrollEnd = function(fn1, fn2) {
        var _this = this.obj;
        _this.on("scrollEnd", fn1);
        if (fn2) fn2();
    };
    //滚动监听
    ScrollBar.prototype.ScrollIng = function(fn) {
        var _this = this.obj;
        //this.obj.on('scroll', fn);
        this.obj.on("scroll", function() {
            if (fn) fn(_this);
        });
    };
    //滚动下拉刷新
    ScrollBar.prototype.ScrollPullDown = function(sOptions) {
        var _this = this.obj;
        _this.pulldown(sOptions);
    };
    exports.ScrollBar = ScrollBar;
    function getFontSize() {
        var doc = document, win = window;
        var docEl = doc.documentElement, resizeEvt = "orientationchange" in window ? "orientationchange" : "resize", recalc = function() {
            var clientWidth = docEl.clientWidth;
            if (!clientWidth) return;
            //如果屏幕大于750（750是根据我效果图设置的，具体数值参考效果图），就设置clientWidth=750，防止font-size会超过100px
            if (clientWidth > 750) {
                clientWidth = 750;
            }
            //设置根元素font-size大小
            docEl.style.fontSize = 100 * (clientWidth / 750) + "px";
        };
        //屏幕大小改变，或者横竖屏切换时，触发函数
        win.addEventListener(resizeEvt, recalc, false);
        //文档加载完成时，触发函数
        // doc.addEventListener('DOMContentLoaded', recalc, false);
        $(doc).ready(function() {
            recalc();
        });
    }
    exports.getFontSize = getFontSize;
    function getGoodsNo(url) {
        var reg = new RegExp("^YW[a-zA-Z0-9]{12,14}$");
        var aUrl = "";
        if (!url) return;
        if (url.indexOf("/") > -1) {
            aUrl = url.substr(0).split("/");
            for (var i = 0; i < aUrl.length; i++) {
                if (checkField(aUrl[i])) {
                    return checkField(aUrl[i]);
                } else if (checkField(aUrl[i]) == undefined) {
                    return false;
                }
            }
        } else {
            if (checkField(url)) {
                return checkField(url);
            } else if (checkField(url) == undefined) {
                return false;
            }
        }
        function checkField(_url) {
            var _aUrl = "";
            if (_url.length >= 14) {
                if (_url.indexOf("?") > 0) {
                    _aUrl = _url.split("?");
                    for (var i = 0; i < _aUrl.length; i++) {
                        if (reg.test(_aUrl[i])) {
                            return _aUrl[i];
                        }
                    }
                } else {
                    if (reg.test(_url)) {
                        return _url;
                    } else {
                        return false;
                    }
                }
            } else {
                return false;
            }
        }
    }
    exports.getGoodsNo = getGoodsNo;
    // 检测 安卓 ios 分享 大当家 链接跳转
    function JudgeAppHref(obj, oldH5) {
        var _href = "";
        var _Num = 0;
        var u = navigator.userAgent;
        //var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
        var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
        //ios终端
        // 返回首页操作
        var hrefToHome = [ "/", "sf://" ];
        var hrefName = [ "/h/goodspay/goodsView/", "sf://goodsDetail?goodsSn=" ];
        var sLocationArg = window.location.search.split("?")[1];
        var fxBtn = false;
        if (sLocationArg !== undefined) {
            if (sLocationArg.search("sell_member_id") > -1) {
                fxBtn = true;
            }
        }
        // 检测室安卓还是ios
        if (u.search("origin/sfddjapp") > 0) {
            if (isIOS) {
                _Num = 1;
                obj.each(function(i) {
                    _href = obj.eq(i).attr("_href");
                    // 检测回到首页
                    if (_href === "home") {
                        obj.eq(i).attr("href", hrefToHome[_Num] + _href);
                    } else {
                        if (getGoodsNo(_href)) {
                            obj.eq(i).attr("href", hrefName[_Num] + getGoodsNo(_href));
                        } else {
                            obj.eq(i).attr("href", _href);
                        }
                    }
                });
            } else {
                obj.each(function(i) {
                    // 检测回到首页
                    _href = obj.eq(i).attr("_href");
                    if (_href === "home") {
                        AndroidReHome(obj.eq(i));
                    } else {
                        if (getGoodsNo(_href)) {
                            //要去掉a标签自带的href属性，因为这个跳转比点击事件要快，如果有这个属性在安卓上会跳转两次
                            obj.eq(i).removeAttr("href");
                            AndroidGoods(obj.eq(i), getGoodsNo(_href));
                        } else {
                            obj.eq(i).attr("href", _href);
                        }
                    }
                });
            }
        } else if (window.__wxjs_environment === "miniprogram") {
            obj.each(function(i) {
                // 如果有_href 这个自定义属性，_href 只有等于 home 或者 商品编号，就回到小程序页面；
                _href = obj.eq(i).attr("_href");
                if (_href) {
                    // 禁用掉 href
                    // obj.eq(i).attr("href", "javascript:void(0);");
                    obj.eq(i).removeAttr("href");
                    // 检测回到首页
                    if (_href === "home") {
                        minAppEven(obj.eq(i));
                    } else {
                        if (getGoodsNo(_href)) {
                            minAppEven(obj.eq(i), getGoodsNo(_href));
                        } else if (isDrawCouponLink(_href)) {
                            minAppEven(obj.eq(i), false, "/pages/home/drawCoupon/drawCoupon?ruleSign=" + isDrawCouponLink(_href));
                        } else {
                            obj.eq(i).attr("href", _href);
                        }
                    }
                }
            });
        } else if (fxBtn) {
            _Num = 0;
            obj.each(function(i) {
                _href = obj.eq(i).attr("_href");
                if (_href === "home") {
                    obj.eq(i).attr("href", hrefToHome[_Num] + _href);
                } else {
                    if (getGoodsNo(_href)) {
                        obj.eq(i).attr("href", hrefName[_Num] + getGoodsNo(_href) + "?" + sLocationArg);
                    } else {
                        obj.eq(i).attr("href", _href + "?" + sLocationArg);
                    }
                }
            });
        } else {
            _Num = 0;
            obj.each(function(i) {
                _href = obj.eq(i).attr("_href");
                var appendData = _href.indexOf("?") > -1 ? "?" + _href.split("?")[1] : "";
                if (_href === "home") {
                    obj.eq(i).attr("href", hrefToHome[_Num] + _href);
                } else {
                    if (getGoodsNo(_href)) {
                        if (oldH5 === "oldH5") {
                            obj.eq(i).attr("href", "/shop/goods/view/" + getGoodsNo(_href) + appendData);
                        } else {
                            obj.eq(i).attr("href", hrefName[_Num] + getGoodsNo(_href) + appendData);
                        }
                    } else {
                        obj.eq(i).attr("href", _href);
                    }
                }
            });
        }
    }
    exports.JudgeAppHref = JudgeAppHref;
    //判断是否是h5的领券页
    function isDrawCouponLink(url) {
        // var  reg = new RegExp("^YW[a-zA-Z0-9]{12,14}$");
        var ruleSignStr = "";
        if (!url) return false;
        if (url.indexOf("/coupon/drawCoupon") > -1) {
            ruleSignStr = url.split("ruleSign=")[1];
            if (ruleSignStr.indexOf("&") > -1) {
                var ruleSign = ruleSignStr.split("&")[0];
                return ruleSign;
            } else {
                return ruleSignStr;
            }
        } else {
            return false;
        }
    }
    exports.isDrawCouponLink = isDrawCouponLink;
    // 小程序事件处理
    function minAppEven(obj, arg, url) {
        obj.off("click");
        obj.on("click", function() {
            // console.log(arg)
            // 小程序物品详情
            if (arg) {
                wx.miniProgram.navigateTo({
                    url: "/pages/shopping/goodsDetail/goodsDetail?goodsSn=" + arg
                });
            } else if (url) {
                wx.miniProgram.navigateTo({
                    url: url
                });
            } else {
                wx.miniProgram.switchTab({
                    url: "/pages/home/home"
                });
            }
        });
    }
    // 安卓绑定点击事件
    function AndroidGoods(obj, arg) {
        obj.off("click");
        obj.on("click", function() {
            android.goodsDetail(arg);
        });
    }
    // 安卓绑定点击返回首页
    function AndroidReHome(obj) {
        obj.off("click");
        obj.on("click", function() {
            android.toMainAcivity();
        });
    }
    function removeArrayChildren(arr, val) {
        var index = arr.indexOf(val);
        if (index > -1) {
            arr.splice(index, 1);
        }
    }
    exports.removeArrayChildren = removeArrayChildren;
    // 弹框获取焦点后 页面高度调整
    function setFocusBodyScrollTop(timer, fn) {
        var cnt = 0;
        var oBody = $("body");
        timer = setInterval(function() {
            if (cnt < 3) {
                cnt++;
            } else {
                clearInterval(timer);
                timer = null;
                return;
            }
            oBody[0].scrollTop = oBody[0].scrollHeight;
            if (fn) fn();
        }, 300);
    }
    exports.setFocusBodyScrollTop = setFocusBodyScrollTop;
    function locationHref(href) {
        $("body").append($('<a href="' + href + '"><span id="locationHrefId"><span><a>'));
        $("#locationHrefId").click();
    }
    exports.locationHref = locationHref;
    // 检测 安卓 ios 隐藏指定对象
    function JudgeAppHide(ios, and, h5) {
        var u = navigator.userAgent;
        //var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
        var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
        //ios终端
        // 检测室安卓还是ios
        if (u.search("origin/sfddjapp") > 0) {
            if (isIOS) {
                if (ios) ios();
            } else {
                if (and) and();
            }
        } else {
            if (h5) h5();
        }
    }
    exports.JudgeAppHide = JudgeAppHide;
    function isIphoneXsMinX() {
        return /iphone/gi.test(navigator.userAgent) && screen.height == 812 && screen.width == 375;
    }
    exports.isIphoneXsMinX = isIphoneXsMinX;
    function isIphoneXRXSMax() {
        return /iphone/gi.test(navigator.userAgent) && screen.height == 896 && screen.width == 414;
    }
    exports.isIphoneXRXSMax = isIphoneXRXSMax;
    /**
     * 判断是否是微信浏览器
     * @returns {Boolean}
     */
    function isWeiXin() {
        var ua = window.navigator.userAgent.toLowerCase();
        if (ua.match(/MicroMessenger/i) == "micromessenger") {
            return true;
        } else {
            return false;
        }
    }
    exports.isWeiXin = isWeiXin;
    /**
     * 判断是否是支付宝浏览器
     * @returns {boolean}
     */
    function isAlipayClient() {
        var ua = window.navigator.userAgent.toLowerCase();
        if (ua.match(/AlipayClient/i) == "alipayclient") {
            return true;
        } else {
            return false;
        }
    }
    exports.isAlipayClient = isAlipayClient;
    /**
     * 判断是否是QQ内置浏览器
     * @returns {boolean}
     */
    function isQQClient() {
        var ua = window.navigator.userAgent.toLowerCase();
        if (ua.match(/QQ/i) == "qq") {
            return true;
        } else {
            return false;
        }
    }
    exports.isQQClient = isQQClient;
    //XSS 前端过滤
    function XssCheck(str, reg) {
        return str ? str.replace(reg || /[&<">'](?:(amp|lt|quot|gt|#39|nbsp|#\d+);)?/g, function(a, b) {
            if (b) {
                return a;
            } else {
                return {
                    "<": "&lt;",
                    "&": "&amp;",
                    '"': "&quot;",
                    ">": "&gt;",
                    "'": ""
                }[a];
            }
        }) : "";
    }
    exports.XssCheck = XssCheck;
    /*
    * 判断用户是否安装app,已安装就跳app,未安装就正常跳h5页面
    * 因可能有安卓跳A页面，ios跳B页面的情况，所以两种终端的url分开写
    * androidUrl, iosUrl是跳的指定页面  比如'https://m.sfddj.com/coupon/toCouponCenter'
    * 如果没有指定页面(首页)就不填写或者填写空'' 如isHasApp('','',function(){})或者isHasApp()
    * */
    function isHasApp(androidUrl, iosUrl, fn) {
        var u = navigator.userAgent;
        var isAndroid = u.indexOf("Android") > -1 || u.indexOf("Linux") > -1;
        //android终端或者uc浏览器
        var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
        //ios终端
        if (u.search("origin/sfddjapp") == -1) {
            if (isAndroid) {
                // 在安卓的终端
                var HrefUrl = "";
                if (androidUrl && androidUrl != undefined && androidUrl != "") {
                    HrefUrl = "ddjapp://cn.dankal.sf/webpage?url=" + androidUrl;
                } else {
                    HrefUrl = "ddjapp://cn.dankal.sf/android";
                }
                // window.location.href = HrefUrl;
                locationHref(HrefUrl);
                setTimeout(function() {
                    if (fn) fn();
                }, 2e3);
            } else if (isiOS) {
                // 在ios的终端
                var HrefUrl = "";
                if (iosUrl && iosUrl != undefined && iosUrl != "") {
                    HrefUrl = "ddjapk://weburl?url=" + iosUrl;
                } else {
                    HrefUrl = "ddjapk://cn.dankal.sf";
                }
                window.location.href = HrefUrl;
                setTimeout(function() {
                    if (fn) fn();
                }, 2e3);
            }
        } else {}
    }
    exports.isHasApp = isHasApp;
    // 获取链接中的指定参数
    function getSearchString(key) {
        var str = window.location.search;
        str = str.substring(1, str.length);
        // 获取URL中?之后的字符（去掉第一位的问号）
        // 以&分隔字符串，获得类似name=xiaoli这样的元素数组
        var arr = str.split("&");
        var obj = new Object();
        // 将每一个数组元素以=分隔并赋给obj对象
        for (var i = 0; i < arr.length; i++) {
            var tmp_arr = arr[i].split("=");
            obj[decodeURIComponent(tmp_arr[0])] = decodeURIComponent(tmp_arr[1]);
        }
        return obj[key];
    }
    exports.getSearchString = getSearchString;
    // 跳转支付宝小程序 根据链接后面的 startAliapp 参数跳转
    function gotoMiniAlipay() {
        var _this = this;
        var startAliapp = getSearchString("startAliapp");
        if (!startAliapp) return;
        if (isWeiXin()) return;
        G_JSON_POST("/m/a/jumpLink/1.0/getJumpLink", {
            jumpLinkId: startAliapp
        }, function(data) {
            var _data = data.data;
            var _ret = data.ret;
            if (_ret.code == "0") {
                if (!_data) return;
                var s = document.createElement("a");
                s.href = _data;
                s.click();
            }
        });
    }
    exports.gotoMiniAlipay = gotoMiniAlipay;
    /**
     * 立即下单统计购买数据上传
     * @param order_sn
     * @param callback
     */
    function uploadCollection(payUrl, one_order_sn, callback) {
        // 立即购买的接口才记录
        if (payUrl !== "/shop/payment/orderPay") {
            return callback && typeof callback == "function" && callback();
        }
        var collectData = "/m/o/order/track/1.0/collectData";
        var sign = "";
        var query = window.location.search;
        query = query && query.trim();
        if (query) {
            query = query && query.split("&").filter(function(item) {
                return item.indexOf("goodMk") !== -1;
            });
            if (query && query[0]) {
                // 获取到的标识：F9VAGD597K1IIW0L
                sign = query[0].replace("goodMk=", "");
            }
        }
        if (one_order_sn && sign) {
            G_JSON_POST(collectData, {
                orderSn: one_order_sn,
                sign: sign
            }, function() {
                callback && typeof callback == "function" && callback();
            }, function() {
                callback && typeof callback == "function" && callback();
            });
        } else {
            callback && typeof callback == "function" && callback();
        }
    }
    exports.uploadCollection = uploadCollection;
});
define("static_v4/js/plug/base64", [], function(require, exports, module) {
    module.exports = new Base64();
    function Base64() {
        // private property
        _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
        // public method for encoding
        this.encode = function(input) {
            var output = "";
            var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
            var i = 0;
            input = _utf8_encode(input);
            while (i < input.length) {
                chr1 = input.charCodeAt(i++);
                chr2 = input.charCodeAt(i++);
                chr3 = input.charCodeAt(i++);
                enc1 = chr1 >> 2;
                enc2 = (chr1 & 3) << 4 | chr2 >> 4;
                enc3 = (chr2 & 15) << 2 | chr3 >> 6;
                enc4 = chr3 & 63;
                if (isNaN(chr2)) {
                    enc3 = enc4 = 64;
                } else if (isNaN(chr3)) {
                    enc4 = 64;
                }
                output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
            }
            return output;
        };
        // public method for decoding
        this.decode = function(input) {
            var output = "";
            var chr1, chr2, chr3;
            var enc1, enc2, enc3, enc4;
            var i = 0;
            input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
            while (i < input.length) {
                enc1 = _keyStr.indexOf(input.charAt(i++));
                enc2 = _keyStr.indexOf(input.charAt(i++));
                enc3 = _keyStr.indexOf(input.charAt(i++));
                enc4 = _keyStr.indexOf(input.charAt(i++));
                chr1 = enc1 << 2 | enc2 >> 4;
                chr2 = (enc2 & 15) << 4 | enc3 >> 2;
                chr3 = (enc3 & 3) << 6 | enc4;
                output = output + String.fromCharCode(chr1);
                if (enc3 != 64) {
                    output = output + String.fromCharCode(chr2);
                }
                if (enc4 != 64) {
                    output = output + String.fromCharCode(chr3);
                }
            }
            output = _utf8_decode(output);
            return output;
        };
        // private method for UTF-8 encoding
        _utf8_encode = function(string) {
            string = string.replace(/\r\n/g, "\n");
            var utftext = "";
            for (var n = 0; n < string.length; n++) {
                var c = string.charCodeAt(n);
                if (c < 128) {
                    utftext += String.fromCharCode(c);
                } else if (c > 127 && c < 2048) {
                    utftext += String.fromCharCode(c >> 6 | 192);
                    utftext += String.fromCharCode(c & 63 | 128);
                } else {
                    utftext += String.fromCharCode(c >> 12 | 224);
                    utftext += String.fromCharCode(c >> 6 & 63 | 128);
                    utftext += String.fromCharCode(c & 63 | 128);
                }
            }
            return utftext;
        };
        // private method for UTF-8 decoding
        _utf8_decode = function(utftext) {
            var string = "";
            var i = 0;
            var c = c1 = c2 = 0;
            while (i < utftext.length) {
                c = utftext.charCodeAt(i);
                if (c < 128) {
                    string += String.fromCharCode(c);
                    i++;
                } else if (c > 191 && c < 224) {
                    c2 = utftext.charCodeAt(i + 1);
                    string += String.fromCharCode((c & 31) << 6 | c2 & 63);
                    i += 2;
                } else {
                    c2 = utftext.charCodeAt(i + 1);
                    c3 = utftext.charCodeAt(i + 2);
                    string += String.fromCharCode((c & 15) << 12 | (c2 & 63) << 6 | c3 & 63);
                    i += 3;
                }
            }
            return string;
        };
    }
});
define("static_v4/js/mod/baiduCount", [], function(require, exports, module) {
    var oBody = $("body");
    function getCookie(name) {
        var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
        if (arr = document.cookie.match(reg)) {
            return unescape(arr[2]);
        } else {
            return null;
        }
    }
    function JudgeSource(ios, and, wxmin, wx, alipay, qq, h5) {
        var u = window.navigator.userAgent;
        //var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
        var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
        //ios终端
        var isWXMini = window.__wxjs_environment == "miniprogram";
        var ua = u.toLowerCase();
        var isWeiXin = ua.match(/MicroMessenger/i) == "micromessenger";
        var isAlipay = ua.match(/AlipayClient/i) == "alipayclient";
        var isQQ = ua.match(/QQ/i) == "qq";
        // 检测室安卓还是ios
        if (u.search("origin/sfddjapp") > 0) {
            if (isIOS) {
                if (ios) ios();
            } else {
                if (and) and();
            }
        } else if (isWXMini) {
            if (wxmin) wxmin();
        } else {
            if (isWeiXin) {
                if (wx) wx();
            } else if (isAlipay) {
                if (alipay) alipay();
            } else if (isQQ) {
                if (qq) qq();
            } else {
                if (h5) h5();
            }
        }
    }
    // 第三方统计的插件
    var TPLMethods = {
        userInfo: JSON.parse(getCookie("ddj-userInfo")),
        // 百度统计
        baidu: function() {
            /**
             *  百度统计
             */
            var sfddjUrl = "9a6219852c6bc360b517de9714e19810";
            //m.sfddj.com
            (function() {
                var hm = document.createElement("script");
                hm.src = "//hm.baidu.com/hm.js?" + sfddjUrl;
                // var s = document.getElementsByTagName("script")[0];
                // s.parentNode.insertBefore(hm, s);
                oBody.append(hm);
            })();
        },
        // gio 统计
        gio: function() {
            var _this = this;
            !function(e, t, n, g, i) {
                e[i] = e[i] || function() {
                    (e[i].q = e[i].q || []).push(arguments);
                }, n = t.createElement("script");
                // tag = t.getElementsByTagName("script")[0];
                // n.async = 1;
                n.src = ("https:" == document.location.protocol ? "https://" : "http://") + g;
                // tag.parentNode.insertBefore(n, tag)
                oBody.append(n);
            }(window, document, "script", "assets.growingio.com/2.1/gio.js", "gio");
            var _gioSetUserId = "";
            if (_this.userInfo) {
                if (_this.userInfo.memberId) {
                    _gioSetUserId = _this.userInfo.memberId;
                } else if (_this.userInfo.openId) {
                    _gioSetUserId = _this.userInfo.openId;
                } else {
                    _gioSetUserId = "";
                }
            }
            gio("init", "b665fa1721dac33b", {});
            // console.log(ddjhoc.userAction)
            // console.log(gio)
            // 给gio 传递用户信息
            gio("setUserId", _gioSetUserId);
            gio("send");
        }
    };
    // ZaneMa Testing
    $.getScript("/static_v4/js/plug/DDJStatistics.js", function(response, status) {
        ddjhoc.init(function() {
            // TPLMethods.baidu();
            TPLMethods.gio();
        });
    });
});